<!DOCTYPE html>
<!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
-->
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: https://ssl.gstatic.com https://v3.alapi.cn https://www.alapi.cn 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:; script-src 'self' 'unsafe-inline' 'unsafe-eval'; connect-src 'self' https://v3.alapi.cn https://www.alapi.cn; frame-src https://www.alapi.cn;">
        <meta name="format-detection" content="telephone=no">
        <meta name="msapplication-tap-highlight" content="no">
        <meta name="viewport" content="initial-scale=1, width=device-width, viewport-fit=cover">
        <meta name="color-scheme" content="light dark">
        <link rel="stylesheet" href="css/index.css">
        <title>网络状态监听</title>
        <style>
            .network-container {
                max-width: 800px;
                margin: 0 auto;
                padding: 20px;
                background-color: #fff;
                min-height: calc(100vh - 100px);
            }
            .nav {
                background-color: #2c3e50;
                padding: 15px;
                text-align: center;
                margin-bottom: 20px;
            }
            .nav a {
                color: #fff;
                text-decoration: none;
                margin: 0 15px;
                font-size: 16px;
                padding: 8px 15px;
                border-radius: 4px;
                transition: background-color 0.3s;
                display: inline-block;
            }
            .nav a:hover, .nav a.active {
                background-color: #34495e;
            }
            .network-header {
                text-align: center;
                margin-bottom: 30px;
                padding-bottom: 20px;
                border-bottom: 2px solid #3498db;
            }
            .network-header h1 {
                color: #2c3e50;
                font-size: 2.5em;
                margin-bottom: 10px;
            }
            .network-header p {
                color: #7f8c8d;
                font-size: 1.1em;
            }
            .status-card {
                background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
                padding: 30px;
                border-radius: 12px;
                margin-bottom: 30px;
                box-shadow: 0 4px 15px rgba(0,0,0,0.1);
                text-align: center;
            }
            .status-icon {
                font-size: 64px;
                margin-bottom: 20px;
            }
            .status-text {
                font-size: 1.5em;
                font-weight: bold;
                margin-bottom: 10px;
                transition: color 0.3s;
            }
            .status-text.wifi {
                color: #27ae60;
            }
            .status-text.cellular {
                color: #f39c12;
            }
            .status-text.offline {
                color: #e74c3c;
            }
            .status-text.unknown {
                color: #95a5a6;
            }
            .status-details {
                background-color: white;
                padding: 25px;
                border-radius: 8px;
                margin-top: 20px;
                box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            }
            .detail-item {
                display: flex;
                justify-content: space-between;
                align-items: center;
                padding: 15px 0;
                border-bottom: 1px solid #eee;
            }
            .detail-item:last-child {
                border-bottom: none;
            }
            .detail-label {
                font-weight: bold;
                color: #2c3e50;
                font-size: 14px;
            }
            .detail-value {
                color: #555;
                font-size: 16px;
            }
            .network-type-badge {
                display: inline-block;
                padding: 4px 12px;
                border-radius: 12px;
                font-size: 12px;
                font-weight: bold;
                text-transform: uppercase;
            }
            .badge-wifi {
                background-color: #d5f4e6;
                color: #27ae60;
            }
            .badge-cellular {
                background-color: #fdeaa7;
                color: #f39c12;
            }
            .badge-offline {
                background-color: #fadbd8;
                color: #e74c3c;
            }
            .badge-unknown {
                background-color: #ecf0f1;
                color: #95a5a6;
            }
            .event-log {
                background-color: #f8f9fa;
                padding: 20px;
                border-radius: 8px;
                margin-top: 20px;
                max-height: 300px;
                overflow-y: auto;
            }
            .event-log-title {
                font-weight: bold;
                color: #2c3e50;
                margin-bottom: 15px;
                font-size: 1.1em;
            }
            .event-item {
                padding: 8px 12px;
                margin-bottom: 8px;
                background-color: white;
                border-radius: 4px;
                border-left: 4px solid #3498db;
                font-size: 13px;
                color: #555;
            }
            .event-item.online {
                border-left-color: #27ae60;
            }
            .event-item.offline {
                border-left-color: #e74c3c;
            }
            .event-item.change {
                border-left-color: #f39c12;
            }
            .event-time {
                color: #95a5a6;
                font-size: 11px;
                margin-left: 10px;
            }
            @media (max-width: 768px) {
                .network-header h1 {
                    font-size: 2em;
                }
                .nav a {
                    display: block;
                    margin: 5px 0;
                }
                .status-icon {
                    font-size: 48px;
                }
            }
        </style>
    </head>
    <body>
        <div class="nav">
            <a href="index.html">首页</a>
            <a href="about.html">关于我们</a>
            <a href="poem.html">藏头诗</a>
            <a href="translate.html">翻译</a>
            <a href="express.html">快递查询</a>
            <a href="ip.html">IP查询</a>
            <a href="workday.html">工作日查询</a>
            <a href="network.html" class="active">网络状态</a>
            <a href="vibrate.html">震动功能</a>
            <a href="battery.html">电池状态</a>
        </div>
        <div class="network-container">
            <div class="network-header">
                <h1>网络状态监听</h1>
                <p>实时监听网络连接状态和网络类型变化</p>
            </div>

            <div class="status-card">
                <div class="status-icon" id="status-icon">📡</div>
                <div class="status-text" id="status-text">正在获取网络状态...</div>
                <div class="status-details" id="status-details">
                    <!-- 详细信息将通过 JavaScript 动态生成 -->
                </div>
            </div>

            <div class="event-log">
                <div class="event-log-title">📋 事件日志</div>
                <div id="event-log-content">
                    <!-- 事件日志将通过 JavaScript 动态生成 -->
                </div>
            </div>
        </div>

        <script src="cordova.js"></script>
        <script src="js/utils.js"></script>
        <script src="js/network.js"></script>
    </body>
</html>

